/*
 * @Descripttion:
 * @LastEditors: xzh
 * @LastEditTime: 2024-07-02 00:57:02
 */
import type { object_Inf } from "@/utils/typings/index.type";
import request from "@/utils/request";
import dashboard_APi from "@/api/dashboard";
/*
 * @Descripttion:设备基本信息接口类
 * @LastEditors: xzh
 * @LastEditTime: 2023-09-07 09:35:39
 */
export default class equipBaseInfo_APi extends dashboard_APi {
  //#region 设备类型接口

  /**
   * @Author: xzh
   * @Descripttion:保存设备类型信息
   * @Param:
   * @param {object} data
   */
  static saveEquipType = (data: object): Promise<object_Inf> =>
    request({
      url: "/api/EquipmentType/SaveEquipmentType",
      method: "post",
      data,
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });
  /**
   * @Author: xzh
   * @Descripttion: 删除设备类型信息
   * @Param:
   * @param {Array} data
   */
  static deleteEquipType = (data: Array<string>): Promise<object_Inf> =>
    request({
      url: "/api/EquipmentType/DeleteEquipmentType",
      method: "post",
      data,
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });
  /**
   * @Author: xzh
   * @Descripttion: 修改设备类型状态
   * @Param:
   * @param {Array} data
   */
  static updateEquipTypeStatus = (
    data: Array<string>,
    status: boolean
  ): Promise<object_Inf> =>
    request({
      url: "/api/EquipmentType/UpdateEquipmentTypeStatus",
      method: "post",
      data: {
        ids: data,
        status,
      },
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });
  /**
   * @Author: xzh
   * @Descripttion: 获取设备类型信息
   * @Param:
   * @param {number} id 设备类型主键
   */
  static getEquipTypeInfo = (id: number): Promise<object_Inf> =>
    request({
      url: "/api/EquipmentType/GetEquipmentType",
      method: "get",
      params: { id },
    });
  /**
   * @Author: xzh
   * @Descripttion:获取设备类型列表
   * @Param:
   */
  static getEquipTypeList = (
    data: object_Inf = {
      keyWord: "",
    }
  ): Promise<Array<object_Inf>> =>
    request({
      url: "/api/EquipmentType/GetEquipmentTypeList",
      method: "post",
      data,
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });
  /**
   * @Author: xzh
   * @Descripttion:获取设备类型报警信息列表
   * @Param:
   */
  static getEquipTypeAlarmInfoList = (
    typeId: string
  ): Promise<Array<object_Inf>> =>
    request({
      url: "/api/EquipmentType/GetAbnormalAlarmInfoByTypeId",
      method: "get",
      params: { typeId },
    });
  /**
   * @Author: xzh
   * @Description: 获取设备异常信息
   * @Param:
   */
  static getEquipAbnormalInfoByCode = (
    equipmentCode: string
  ): Promise<object_Inf> =>
    request({
      url: "/api/EquipmentAbnormal/GetAbnormalInfoByEquipmentCode",
      method: "get",
      params: { equipmentCode },
    });

  /**
   * @Author: xzh
   * @Description: 获取设备点位信息
   * @Param:
   * @param {string} typeId
   */
  static getEquipPointInfo = (typeId: string): Promise<object_Inf> =>
    request({
      url: "/api/EquipmentType/GetAbnormalAlarmPointPositionInfo",
      method: "get",
      params: { typeId },
    });
  /**
   * @Author: xzh
   * @Descripttion:保存设备点位信息
   * @Param:
   * @param {object} data
   */
  static saveEquipPointInfo = (data: object): Promise<object_Inf> =>
    request({
      url: "/api/EquipmentType/SaveAbnormalAlarmPointPositionInfo",
      method: "post",
      data,
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });

  /**
   * @Author: xzh
   * @Description: 导出设备异常信息
   * @Param:
   */
  static exportEquipAbnormalInfo = (typeId: string): Promise<object_Inf> =>
    request({
      url: "/api/File/GetFile",
      method: "get",
      params: { fileOid: typeId },
      responseType: "blob",
    });
  /**
   * @Author: xzh
   * @Description: 上传设备异常信息
   * @Param:
   */
  static uploadEquipAbnormalInfo = (data: object_Inf): Promise<object_Inf> =>
    request({
      url: `/api/EquipmentType/UploadAbnormalAlarmInfo`,
      method: "post",
      data,
      headers: { "Content-Type": "multipart/form-data" },
    });

  //#endregion

  //#region 设备状态接口

  /**
   * @Author: xzh
   * @Descripttion:保存设备状态信息
   * @Param:
   * @param {object} data
   */
  static saveEquipState = (data: object): Promise<object_Inf> =>
    request({
      url: "/api/EquipmentStatus/SaveEquipmentStatus",
      method: "post",
      data,
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });
  /**
   * @Author: xzh
   * @Descripttion: 删除设备状态信息
   * @Param:
   * @param {Array} data
   */
  static deleteEquipState = (data: Array<string>): Promise<object_Inf> =>
    request({
      url: "/api/EquipmentStatus/DeleteEquipmentStatus",
      method: "post",
      data,
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });
  /**
   * @Author: xzh
   * @Descripttion: 获取设备状态信息
   * @Param:
   * @param {number} id 设备状态主键
   */
  static getEquipStateInfo = (id: number): Promise<object_Inf> =>
    request({
      url: "/api/EquipmentStatus/GetEquipmentStatus",
      method: "get",
      params: { id },
    });
  /**
   * @Author: xzh
   * @Descripttion:获取设备状态列表
   * @Param:
   */
  static getEquipStatePageList = (
    data: object_Inf = {
      keyWord: "",
    }
  ): Promise<object_Inf> =>
    request({
      url: "/api/EquipmentStatus/GetEquipmentStatusPageList",
      method: "post",
      data,
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });
  //#endregion

  //#region 设备档案接口

  /**
   * @Author: xzh
   * @Descripttion:保存设备档案信息
   * @Param:
   * @param {object} data
   */
  static saveEquipArchives = (data: object): Promise<object_Inf> =>
    request({
      url: "/api/EquipmentInfo/SaveEquipmentInfo",
      method: "post",
      data,
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });
  /**
   * @Author: xzh
   * @Descripttion: 删除设备档案信息
   * @Param:
   * @param {Array} data
   */
  static deleteEquipArchives = (data: Array<string>): Promise<object_Inf> =>
    request({
      url: "/api/EquipmentInfo/DeleteEquipmentInfo",
      method: "post",
      data,
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });
  /**
   * @Author: xzh
   * @Descripttion: 获取设备档案信息
   * @Param:
   * @param {number} id 设备档案主键
   */
  static getEquipArchivesInfo = (id: number): Promise<object_Inf> =>
    request({
      url: "/api/EquipmentInfo/GetEquipmentInfo",
      method: "get",
      params: { id },
    });
  /**
   * @Author: xzh
   * @Descripttion: 获取设备检索列表
   * @Param:
   * @param {object_Inf} data
   */
  static getEquipArchivesList = (data: object_Inf): Promise<object_Inf> =>
    request({
      url: "/api/EquipmentInfo/GetEquipmentInfoList",
      method: "post",
      data,
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });
  //#endregion

  //#region 设备注册接口

  /**
   * @Author: xzh
   * @Descripttion:保存设备注册信息
   * @Param:
   * @param {object} data
   */
  static saveEquipRegister = (data: object): Promise<object_Inf> =>
    request({
      url: "/api/EquipmentRegister/SaveEquipmentRegister",
      method: "post",
      data,
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });
  /**
   * @Author: xzh
   * @Descripttion: 删除设备注册信息
   * @Param:
   * @param {Array} data
   */
  static deleteEquipRegister = (data: Array<string>): Promise<object_Inf> =>
    request({
      url: "/api/EquipmentRegister/DeleteEquipmentRegister",
      method: "post",
      data,
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });
  /**
   * @Author: xzh
   * @Descripttion: 修改设备类型状态
   * @Param:
   * @param {Array} data
   */
  static updateEquipTypeRegister = (
    data: Array<string>,
    status: boolean
  ): Promise<object_Inf> =>
    request({
      url: "/api/EquipmentRegister/UpdateEquipmentRegisterStatus",
      method: "post",
      data: {
        ids: data,
        status,
      },
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });
  /**
   * @Author: xzh
   * @Descripttion: 获取设备注册信息
   * @Param:
   * @param {number} id 设备注册主键
   */
  static getEquipRegisterInfo = (id: number): Promise<object_Inf> =>
    request({
      url: "/api/EquipmentRegister/GetEquipmentRegister",
      method: "get",
      params: { id },
    });
  /**
   * @Author: xzh
   * @Descripttion:获取设备注册列表
   * @Param:
   */
  static getEquipRegisterList = (
    data: object_Inf = {
      keyWord: "",
    }
  ): Promise<object_Inf> =>
    request({
      url: "/api/EquipmentRegister/GetEquipmentRegisterList",
      method: "post",
      data,
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });
  //#endregion
}
